package cn.foolishbird.hamal.frame.config.shiro;
import lombok.Data;
import org.apache.shiro.authc.AuthenticationToken;

/**
 * 无状态token
 *
 * @author Eric
 * @version 1.0
 * @date 2019-06-23
 */
@Data
public class StatelessToken implements AuthenticationToken {

    private String tokenKey;

    private String randomNum;

    private String tokenSign;

    public StatelessToken(String tokenKey, String randomNum, String tokenSign) {
        this.tokenKey = tokenKey;
        this.randomNum = randomNum;
        this.tokenSign = tokenSign;
    }

    @Override
    public Object getPrincipal() {
        //身份 一般是username
        return tokenKey;
    }

    @Override
    public Object getCredentials() {
        //认证  一般是passward
        return tokenSign;
    }

}
